import random
import time

print(random.random())#获取0-1之间的小数
print(random.randint(1,100)) #随机指定范围整数
alist = [1,2,3,4,5]
print(random.choice(alist))
print(random.choices(alist,k=2))
#洗牌
random.shuffle(alist)
print(alist)


#time模块

#休眠函数
time.sleep(0.1)
print("------------------")

print(time.time())#获取当前时间时间戳

#获取当前时间的时间元组
print(time.localtime())

#时间元组和时间字符串类型的转换
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))

print(time.strptime("2025-09-08 10:54:38","%Y-%m-%d %H:%M:%S"))

#随机生成1-100之间的30个数，放到列表中，不允许重复

resultList = []
while len(resultList) < 30:
    i = random.randint(1, 1000)
    if i not in resultList:
        resultList.append(i)
print(i)
print(resultList)